home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume90
/
util
/
qt
/
qt.asm
< prev
next >
Wrap
Assembly Source File
|
1990-03-03
|
4KB
|
218 lines
; Qt -- What time is it?
;
; Original version (c) 1989 by Martin Laubach
; Heavy modifications (c) Jim Butterfield Jan 31, 1990
; Beautified by mjl
;
; :ts=12
include "exec/types.i"
include "libraries/dos.i"
optimon
;-----------------------------------------------------------------
call macro
xref _LVO\1
jsr _LVO\1(a6)
endm
vector macro
dc.b \1-Hr12
endm
;-----------------------------------------------------------------
; Local variables
Local_SIZE: equ ds_SIZEOF ; I need a local DateStamp
Today: equ -Local_SIZE
;-----------------------------------------------------------------
section Qt,code
Main: link a4,#-Local_SIZE
move.l 4,a6
lea DosName(pc),a1
moveq #33,d0
call OpenLibrary
move.l d0,a6
call Output
move.l d0,a5
lea Today(a4),a0
move.l a0,d1
call DateStamp
move.l Today+ds_Minute(a4),d6
moveq #27,d7
add.l d7,d6
divu #60,d6
move.w d6,d7 ; hours (quotient)
moveq #12,d4
divu d4,d7 ;
clr.w d7
swap d7 ; hours (0-11)
clr.w d6
swap d6 ; mins (remainder)
moveq #It.vec-Hr.vecs,d0
bsr.s PutStr
divu #5,d6 ; clock divisions
swap d6 ; 'almost' adjustment
moveq #Ny.vecs-Hr.vecs,d0
add.w d6,d0
bsr.s PutStr
swap d6 ; clock divisions
moveq #Ps.vec-Hr.vecs,d5
subq.w #5,d6 ; adjust to hour
beq.s Exact
bpl.s GotToP
moveq #To.vec-Hr.vecs,d5
neg.w d6
GotToP: moveq #Ft.vecs-Hr.vecs,d0
add.w d6,d0
bsr.s PutStr
move.l d5,d0
bsr.s PutStr
Exact: moveq #Hr.vecs-Hr.vecs,d0
add.w d7,d0
bsr.s PutStr
moveq #OC.vec-Hr.vecs,d0
tst.w d6
bne.s NoOclk
bsr.s PutStr
NoOclk: lea NewLine.CHR(pc),a3
bsr.s Prt1
move.l a6,a1
move.l 4,a6
call CloseLibrary
unlk a4
rts
;-----------------------------------------------------------------
; Print item from table (Hr.vecs)
; D0 = String number
; -->
; Nil
PutStr: lea Hr.vecs(pc),a0
moveq #0,d2
moveq #0,d3
move.b 0(a0,d0.w),d2 ; Get buffer offset
move.b 1(a0,d0.w),d3 ; Get next item offset
sub.w d2,d3 ; Length of string
beq.s Exit ; No string
lea Hr12(pc),a3 ; Begin of string table
add.l a3,d2 ; Begin of string
;-----------------------------------------------------------------
; Print something + space
; D2 = Pointer to something
; D3 = Length of something
; -->
; Nil
PrtItem: bsr.s Put1
lea Space.CHR(pc),a3
Prt1: move.l a3,d2
moveq #1,d3
Put1: move.l a5,d1 ; handle
Gotstr: call Write
Exit: moveq #0,d0
rts
;-----------------------------------------------------------------
; String vector table
Hr.vecs: vector Hr12
vector Hr01
vector Hr02
vector Hr03
vector Hr04
vector Hr05
vector Hr06
vector Hr07
vector Hr08
vector Hr09
vector Hr10
Ft.vecs: vector Hr11
vector Mn05
vector Mn10
vector Mn15
vector Mn20
vector Mn25
vector Mn30
Ny.vecs: vector nearly
vector almost
vector justpast
vector justpast
vector after
It.vec: vector Itis
Ps.vec: vector Past
To.vec: vector UpTo
OC.vec: vector OClock
vector Space.CHR
;-----------------------------------------------------------------
; Strings
Hr12: dc.b 'twelve'
Hr01: dc.b 'one'
Hr02: dc.b 'two'
Hr03: dc.b 'three'
Hr04: dc.b 'four'
Hr05: dc.b 'five'
Hr06: dc.b 'six'
Hr07: dc.b 'seven'
Hr08: dc.b 'eight'
Hr09: dc.b 'nine'
Hr10: dc.b 'ten'
Hr11: dc.b 'eleven'
Mn05: dc.b 'five'
Mn10: dc.b 'ten'
Mn15: dc.b 'a quarter'
Mn20: dc.b 'twenty'
Mn25: dc.b 'twenty-five'
Mn30: dc.b 'half'
nearly: dc.b 'nearly'
almost: dc.b 'almost'
justpast: dc.b 'just after'
after: dc.b 'after'
Itis: dc.b 'It''s'
Past: dc.b 'past'
UpTo: dc.b 'to'
OClock: dc.b 'o''clock'
Space.CHR: dc.b ' '
NewLine.CHR: dc.b 10
DosName: dc.b 'dos.library',0
end